<!--
 * @Author: your name
 * @Date: 2021-04-17 15:49:26
 * @LastEditTime: 2021-04-17 15:49:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \智慧医疗项目\app\src\views\pages\doctor\office\docList\docList.vue
-->
<template>
  <div class="docList">
    <p>科室北京301医院-主治医师列表</p>
    <div v-show="!isThree">
      <div class="search">
        <input type="text" placeholder="请输入要搜索的医师" />
      </div>
      <el-table :data="docList" border style="width: 100%">
        <el-table-column prop="id" label="序号" width="50">
        </el-table-column>
        <el-table-column prop="userid" label="用户ID"> </el-table-column>
        <el-table-column prop="grade" label="主治医师"> </el-table-column>
        <el-table-column prop="name" label="医师姓名" width="70">
        </el-table-column>
        <el-table-column prop="year" label="年限" width="50"> </el-table-column>
        <el-table-column prop="bookOne" label="医师资格证书">
          <el-button type="text" @click="dialogVisible = true"
            >查看资格证书</el-button
          >
        </el-table-column>
        <el-table-column prop="bookTwo" label="医师执业证书">
          <el-button type="text" @click="dialogVisible = true"
            >查看执业证书</el-button
          >
        </el-table-column>
        <el-table-column prop="number" label="问诊次数"> </el-table-column>
        <el-table-column prop="moneny" label="总收入金额"> </el-table-column>
        <el-table-column prop="title" label="好评度"> </el-table-column>
        <el-table-column prop="handle" label="操作">
          <el-button @click="handle">详情</el-button>
        </el-table-column>
      </el-table>
      <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <span>这是一段信息</span>
        <span slot="footer" class="dialog-footer">
          <img
            class="picture"
            src="https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1563717527,1884353393&fm=11&gp=0.jpg"
            alt=""
          />
        </span>
      </el-dialog>
    </div>
    <router-view v-show="isThree"></router-view>
  </div>
</template>

<script>
import axios from "axios"
export default {
  data() {
    return {
      isThree: false,
      dialogVisible: false,
      docList:[],
    };
  },
  created(){
    axios({
      url:"/api/docList"
    }).then(res=>{
      this.docList = res.data.doclist;
      console.log(this.docList)
    })
  },
  watch: {
    $router: function () {
      console.log(this.$route);
      if (this.$route.path === "/home/docDetail") {
        this.isThree = true;
      } else {
        this.isThree = false
      }
    },
  },
  methods: {
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    handle() {
      this.$router.push("/home/docDetail");
    },
  },
};
</script>

<style lang="scss" scoped>
.docList p {
  height: 30px;
  width: 100%;
  border-bottom: 3px solid rgb(44, 44, 170);
}
.docList .search {
  width: 100%;
  height: 40px;
  line-height: 40px;
}
.docList .picture {
  width: 100%;
  height: 100%;
}
</style>